﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using Converter;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Telerik.Windows.Controls;
using System.Resources;
using System.Reflection;
using Accounting.Library;
using csla4Skeleton.UI.SL.Reports.TienMat;
using csla4Skeleton.UI.SL.Reports.NganHang;
using csla4Skeleton.UI.SL.Reports.BanHang;
using csla4Skeleton.UI.SL.Reports.MuaHang;

namespace csla4Skeleton.UI.SL.Reports
{
    public partial class FormThongTin : ChildWindow
    {
        private ReportType reportType;
        public FormThongTin(ReportType reportType)
        {
            this.reportType = reportType;
            LocalizationConverter converter = new LocalizationConverter();
            converter.LocalResourceManager = new ResourceManager("csla4Skeleton.UI.SL.Reports.Resources", Assembly.GetExecutingAssembly());
            this.Resources.Add("Localization", converter);
            InitializeComponent();


        }

        private void OK_button_Click(object sender, RoutedEventArgs e)
        {
            if (ThangTextBox.Text.Equals("") || ThangTextBox.Text == null || NamTextBox.Text.Equals("") || NamTextBox.Text == null)
            {
                MessageBoxResult notice = MessageBox.Show("Bạn chưa nhập liệu đầy đủ", "Chưa nhập liệu", MessageBoxButton.OKCancel);
            }
            else
            {
                this.Close();
                int Thang = 0;
                int Nam = 0;
                try
                {
                    Thang = int.Parse(ThangTextBox.Text);
                    Nam = int.Parse(NamTextBox.Text);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }

                if (this.reportType == ReportType.Cash_FundBookDetailReport)
                {
                    Cash_FundBookDetailReport cash_FundBookDetailReport = new Cash_FundBookDetailReport(Thang, Nam);
                    cash_FundBookDetailReport.Show();
                }
                else if (this.reportType == ReportType.Bank_FundBookDetailReport)
                {
                    int TaiKhoan = 112;
                    Bank_FundBookDetailReport bank_FundBookDetailReport = new Bank_FundBookDetailReport(Thang, Nam, TaiKhoan);
                    bank_FundBookDetailReport.Show();
                }
                else if (this.reportType == ReportType.Cash_FundBookReport)
                {
                    int TaiKhoan = 111;
                    Cash_FundBookReport cash_FundBookReport = new Cash_FundBookReport(Thang, Nam, TaiKhoan);
                    cash_FundBookReport.Show();
                }
                else if (this.reportType == ReportType.Buy_InvoiceBookReport)
                {
                    Buy_InvoiceBookReport buy_InvoiceBookReport = new Buy_InvoiceBookReport(Thang, Nam);
                    buy_InvoiceBookReport.Show();
                }
                else if (this.reportType == ReportType.Sales_InvoiceBookReport)
                {
                    Sales_InvoiceBookReport sales_InvoiceBookReport = new Sales_InvoiceBookReport(Thang, Nam);
                    sales_InvoiceBookReport.Show();
                }
            }
        }


    }
}

